package com.stanford.ml.naivebayes;

/**
 * Class label is a rating by the user. It's value is either 1 or -1
 * 
 * @author Fatih Sunor
 * 
 */
public class ClassLabel {

	private String _name;

	public ClassLabel(String name) {
		_name = name;
	}

	public String getName() {
		return _name;
	}

	public int hashCode() {
		final int prime = 37;
		int result = 1;
		result = prime * result + ((_name == null) ? 0 : _name.hashCode());
		return result;
	}

	public boolean equals(Object obj) {
		final ClassLabel other = (ClassLabel) obj;
		if(this == obj){
			return true;
		}
		if(!(obj instanceof ClassLabel)){
			return false;
		}
		if (_name == null) {
			if (other._name != null) {
				return false;
			}
		} else if (!_name.equals(other._name)) {
			return false;
		}
		return true;
	}
}
